package com.example.metodo_post;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

public class web_page {
	//public String url_server;
	public List<String> metodo_retorno(String url_server){
		List<String> myList = new ArrayList<String>();
		try{
		HttpClient cliente = new DefaultHttpClient();
		HttpPost post = new HttpPost("http://"+url_server+"/get_clients.php");
		
		HttpResponse respuesta = cliente.execute(post);
		HttpEntity entidad = respuesta.getEntity();
		
		String datos = EntityUtils.toString(entidad);
		String[] cortado = datos.split(":");
		myList = Arrays.asList(cortado);
		
		return myList;
		
		}catch(Exception e){
			myList.add(e.getMessage());
			return myList;
		}
	}
}
